package sushil.luc.msc;


import sushil.luc.ticket.Ticket;
import android.content.Context;
import com.ugrokit.api.UgiTag;
/**
 * If a Tag was found this handler calls the correct Manager, which uses the tag in the way as expect
 * @author Luc
 *
 */
public class MyHandler {
	
	
	private TruckerCheckManager tc_manager;
	private boolean modeTruckerCheck;
	
	/**
	 * Init all the handler
	 * @param con
	 */
	public MyHandler(Context con)
	{
		tc_manager = new TruckerCheckManager(con);
	}
	

	/**
	 * Turn on the Trucker scan Mode
	 * @param mode true = on, false =off
	 */
	public void modeTruckerCheck( boolean mode, Ticket t)
	{
		tc_manager.reset();
		tc_manager.setTicket(t);
		modeTruckerCheck = mode;
	}
	
	/**
	 * Send the Tag to the correct handler
	 * @param current
	 */
	public void setTag(UgiTag current)
	{
		if (modeTruckerCheck)
			TruckerCheckScan(current);		
	}

	/**
	 * Give the Trucker Check manager the new tag
	 * @param tag
	 */
	private void TruckerCheckScan (UgiTag tag)
	{
		tc_manager.handleTag(tag);
	}
}
